<?php
session_start();
if(isset($_GET['language'])) {
	$_SESSION['language'] = $_GET['language'];
	header("location: ".$_SESSION['url']);
} else {
	if(!isset($_SESSION['language'])) {
		$_SESSION['language'] = 'vi';
	}
}
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
$language = $_SESSION['language'];

include_once('languages/'.$language.'.php');
include_once('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
echo '
<title>'.metaTitle.'</title>
<meta name="title" content="'.metaTitle.'" />
<meta name="description" content="'.metaDescription.'" />
<meta name="keywords" content="'.keywords.'" />
<meta name="robots" content="INDEX,FOLLOW" />
<meta http-equiv="content-language" content ="vi" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="'.metaTitle.'" />
<meta property="og:description" content="'.metaDescription.'" />
<meta property="og:image" content="/images/logo.jpg" />
';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="library/jquery.js"></script>
<script type="text/javascript" src="website.js"></script>
</head>

<body>

<div id="header">
	<div style="width:1000px; margin:auto">
    	<div id="logo"><a href=""><img src="images/logo.jpg" alt="logo vietnamworks" /></a></div>
    	<div id="lang"><a href="index.html?language=vi">Tiếng Việt</a> &nbsp;|&nbsp; <a href="index.html?language=en">English</a></div>
    </div>
</div>
<div id="content"><div style="width:1000px; margin:auto">
	<div id="clock">
        <div><span><?php echo time_end; ?></span><br />
        <span style="font-size:30px; font-weight:bold" id="bp_count_down_div"></span></div>
        
		<script language="JavaScript"> 
            var bp_date_target = new Date("<?php echo $moc_thoi_gian; ?>");//Mốc thời gian cần đếm(tháng ghi bằng chữ) 
            var bp_date_now = new Date(); 
            var bp_count_down_complete_message = "Hết giờ";//Lời chúc khi tới giáng sinh 
            if (bp_date_now >= bp_date_target) {
                document.getElementById("bp_count_down_div").innerHTML = bp_count_down_complete_message;
            } else { 
                bp_time_difference = Math.floor(((bp_date_target - bp_date_now).valueOf()) / 1000);
                display_time_difference(bp_time_difference);
            }
            function display_time_difference(bp_time_difference) {
                if (bp_time_difference <= 0) {
                    document.getElementById("bp_count_down_div").innerHTML = bp_count_down_complete_message;
                    return;
                }
                bp_count_down_message = parseInt(bp_format_seconds(bp_time_difference, 86400, 100000)*24) + parseInt(bp_format_seconds(bp_time_difference, 3600, 24)) + ":" + bp_format_seconds(bp_time_difference, 60, 60) + ":" + bp_format_seconds(bp_time_difference, 1, 60);
                document.getElementById("bp_count_down_div").innerHTML = bp_count_down_message;
                setTimeout("display_time_difference(" + (bp_time_difference - 1) + ")", 1000);
            }
            function bp_format_seconds(secs, num1, num2) { 
                num = ((Math.floor(secs / num1)) % num2).toString();
                if (num.length < 2) s = "0" + num;
                return "" + num + "";
            } 
        </script>
    	<img src="images/clock.png" alt="clock vietnamworks" />
    </div>
    <div id="promotion">
    	<h1><?php echo title; ?></h1>
        <h2><?php echo promotion; ?></h2>
        <div class="item"><?php echo item1; ?></div>
        <div class="item"><?php echo item2; ?></div>
        <h4><?php echo dieukhoan; ?></h4>
    </div>
</div></div>

<div id="footer"><div style="width:1000px; margin:auto"><div id="loading"><?php echo loading; ?></div>
	<div id="frm">
    	<h5><?php echo dangkynhan; ?></h5>
        <div style="clear:both; display:none; margin-bottom:10px; color:#F00; font-weight:bold" id="error"><?php echo error; ?></div>
        <div><input type="text" name="congty" value="<?php echo congty; ?>" class="txt" onfocus="if(value=='<?php echo congty; ?>') value=''" />
        <input type="text" name="hoten" value="<?php echo hoten; ?>" class="txt" onfocus="if(value=='<?php echo hoten; ?>') value=''" /></div>
        <div><input type="text" name="dienthoai" value="<?php echo dienthoai; ?>" class="txt" onfocus="if(value=='<?php echo dienthoai; ?>') value=''" />
        <input type="text" name="email" value="<?php echo email; ?>" class="txt" onfocus="if(value=='<?php echo email; ?>') value=''" /></div>
        <div style="clear:both; height:1px"></div>
        <div><span style="width:auto; float:left"><input type="checkbox" name="dongy" style="float:left" /> &nbsp;<?php echo dongy; ?></span>
        <span id="register"><?php echo btndangki; ?></span></div>
<script type="text/javascript">
$(document).ready(function() {
	$("#register").click(function(){
		var congty = $.trim($("input[name=congty]").val());
		var hoten = $.trim($("input[name=hoten]").val());
		var dienthoai = $.trim($("input[name=dienthoai]").val());
		var email = $.trim($("input[name=email]").val());
		var dongy = $.trim($("input[name=dongy]:checked").val());
		if(dongy!='on'){
			alert("<?php echo dongy_check; ?>");
		}
		if(congty=='' || congty=='<?php echo congty; ?>'){
			$("input[name=congty]").css('border','solid 2px #F00');
		}else{
			$("input[name=congty]").css('border','solid 1px #CCC');
		}
		if(hoten=='' || hoten=='<?php echo hoten; ?>'){
			$("input[name=hoten]").css('border','solid 2px #F00');
		}else{
			$("input[name=hoten]").css('border','solid 1px #CCC');
		}
		if(dienthoai.length<10 || isNaN(dienthoai)==true){
			$("input[name=dienthoai]").css('border','solid 2px #F00');
		}else{
			$("input[name=dienthoai]").css('border','solid 1px #CCC');
		}
		if(email=='' || email=='<?php echo email; ?>'){
			$("input[name=email]").css('border','solid 2px #F00');
		}else{
			$("input[name=email]").css('border','solid 1px #CCC');
		}
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))){
			$("input[name=email]").css('border','solid 2px #F00');
		}else{
			$("input[name=email]").css('border','solid 1px #CCC');
		}
		if(dongy!='on' || congty=='' || congty=='<?php echo congty; ?>' || hoten=='' || hoten=='<?php echo hoten; ?>' || dienthoai.length<10 || (isNaN(dienthoai)==true) ||  email=='<?php echo email; ?>' || email=='' || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))){
			$("#error").css('display','block');
			return false;
		}else{
			$("#error").css('display','none');
			$("#loading").css('display','block');
			$("#frm").css('display','none');
			$.post("ajax.php",{register:"register",congty:congty,hoten:hoten,dienthoai:dienthoai,email:email,dongy:dongy},function(data){
				if(data!=0) $("#loading").html('<?php echo message; ?>');
				else{
					$("#loading").css('display','none');
					$("#frm").css('display','block');
					alert("<?php echo error; ?>");
				}
			});
		}
	});
});
</script>
    </div>
    <div id="contact">
    	<div><?php echo share; ?> 
        <a href="http://www.linkedin.com/shareArticle?url=<?php echo $link_socail?>&title=<?php echo metaTitle; ?>&summary=<?php echo metaDescription; ?>" target="_blank"><img src="images/icon_in.jpg" alt="in" /></a>
        <a href="https://twitter.com/intent/tweet?original_referer=<?php echo $link_socail?>&text=<?php echo metaDescription;?>&url=http://www.vietnamworks.com/promotion" target="_blank"><img src="images/icon_tw.jpg" alt="twitter" /></a> 
        <a href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $link_socail?>" target="_blank"><img src="images/icon_fb.jpg" alt="facebook" /></a> </div><div style="clear:both; height:1px"></div>
        <h6>HCM: (84-8) 3 925 8456</h6><h6>HN: &nbsp; (84-4) 3 944 0568</h6>
        <p>Copyright @ 2013 - Navigos Group</p>
    </div>
</div></div>

<div id="backgroundPopup"></div>
<div id="popupContact">
    <a id="popupContactClose"><img src="images/close.jpg" alt="close" style="padding:5px 10px" /></a>
   <div style="height:18px; background-color:#00B9F3"><span style="color:#00B9F3; padding:5px 20px; background-color:#FFF; font-weight:bold; font-size:18px; margin-left:50px"><?php echo quydinh; ?></span></div><?php echo popup_info; ?>
</div>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-103236-1']);
  _gaq.push(['_setDomainName', 'vietnamworks.com']);
  _gaq.push(['_trackPageview']);
  
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</body>
</html>